package day05;

import day03.IfElseIfDemo;

import java.sql.SQLOutput;

//求数组元素的最大值
public class MaxofArray {
    public static void main(String[] args) {
        /*
        int[] arr={3,5,7,34,54,25};
        int max=arr[0];
        for (int i=1;i<arr.length;i++){
            if (arr[i]>max){
                max=arr[i];
            }
        }
        System.out.println("最大值为："+max);

        int[] acc= {13,84,26,17,48,68,641,41,481};
        int mca=acc[0];
        for (int c=1;c>acc.length;c++){
            if (acc[c]<mca){
                mca=acc[c];
            }
        }
        System.out.println("最大值为："+mca);
         */
        /*int sum=0;
        for (int i=2;i<=100;i+=2){
            sum+=i;
        }
        System.out.println("sum="+sum);
        */
        /*int num=1;
        for (int i=1;i<=8;i++){
            num*=i;
        }
        System.out.println("num"+num);

         */

        for (int nn=1;nn<=11;nn+=2){
            for (int o=1;o<=nn;o++){
                System.out.print("*");
            }
            System.out.println();
        }
        for(int i=0;i<6;i++){
            for(int k=1;k<=2*i+1;k++){
                System.out.print("*");
            }
            System.out.println();
        }

        for (int i=1;i<=6;i++){
            System.out.println();
            for (int o=1;o<=11-i;o++){
                System.out.print(" ");
            }
            for (int k=1;k<=i*2-1;k++) {
                System.out.print("*");
            }

        }
        int[] a=new int[10];
        for (int p=0;p<a.length;p++){
            a[p]=(int)(Math.random()*100);
            System.out.println(a[p]);
        }
        int m=a[0];
        int n=a[0];
        for (int t=1;t<a.length;t++){
            if (a[t]>m){
                m=a[t];
            }else if (a[t]<n){
                n=a[t];
            }
        }
        System.out.println("最大值为："+m+"最小值为："+n);

        int z=0;
        for (int r=2;r<=100;r+=2){
            z=r;
        }
        System.out.println("z="+z);


        int num=1;
        for (int i=1;i<=8;i++){
            num*=i;
        }
        System.out.println("num="+num);

        for (int i=1;i<=6;i++){
            System.out.println();
            for (int o=1;o<=11-i;o++){
                System.out.print(" ");
            }
            for (int k=1;k<=i*2-1;k++) {
                System.out.print("*");
            }

        }





    }
}
